<template>
	<el-dialog title="项目审批对话框" v-model="visible" width="400px" destroy-on-close @closed="$emit('closed')">
		<el-form :model="form" ref="dialogForm" label-width="100px" label-position="left">
			<el-form-item label="项目名称" prop="title">{{ form.title }}
			</el-form-item>
			<el-form-item label="审批意见">
				<el-radio-group v-model="form.status">
					<el-radio-button label="1">驳回</el-radio-button>
					<el-radio-button label="3">通过</el-radio-button>
				</el-radio-group>
			</el-form-item>
			<el-form-item label="审批意见">
				<el-input v-model="form.ideaText" placeholder="审批意见" clearable maxlength="380" type="textarea"></el-input>
			</el-form-item>
		</el-form>
		<template #footer>
			<el-button @click="visible=false">取 消</el-button>
			<el-button type="primary" :loading="isSaveing" @click="submit()">确 定</el-button>
		</template>
	</el-dialog>

</template>
<script>
export default {
	emits: ['success', 'closed'],
	components: {},
	data() {
		return {
			visible: false,
			isSaveing: false,
			form: {
				proId: '',
				title: '',
				ideaText: '',
				status: "3"
			},
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this
		},
		async submit() {
			this.isSaveing = true;
			var res = await this.$API.project.proApproval.setApprovalProRecord.post(this.form);
			this.isSaveing = false;
			if (res.code == 200) {
				this.$emit('success')
				this.visible = false;
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		setData(data) {
			this.form.proId = data.proId
			this.form.title = data.title
		},
	}
}
</script>

<style>
.customWidth {
	width: 60%;
}
</style>
